package top.sjydzq.one.Mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import top.sjydzq.one.Entity.Article;

import java.util.List;

@Mapper
@Repository
public interface ArticleMapper {

    @Select("SELECT * FROM article ORDER BY id DESC")
    List<Article> selectAll();

    @Select("SELECT * FROM article WHERE id=#{id}")
    Article selectById(int id);

    @Select("SELECT * FROM article WHERE cat_id=#{catId} ORDER BY id DESC")
    List<Article> selectByCatId(int catId);
}
